/*
 * Copyright (C) 2017 Pingan, Inc. All Rights Reserved.
 */
package com.pingan.haofang.searchcloud.api.matedata;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 好房SearchCloud Collection
 *
 * @author huhailiang937
 * @date 2017年4月6日下午9:40:58
 * @since 1.0.0
 */
public class CollectionMetaData {

    /**
     * collection名称
     */
    private String name;

    /**
     * 配置名称
     */
    private String configName;

    /**
     * 分片数
     */
    private Integer shardCount;

    /**
     * 副本数
     */
    private Integer replicationFactor;

    /**
     * 每个节点最大分片数（默认为1）
     */
    private Integer maxShardsPerNode;

    /**
     * 路由方式
     */
    private Router router;


    private boolean autoAddReplicas = false;

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }


    public static class Router {
        private String name;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
        }
    }


    /**
     * @return the configName
     */
    public String getConfigName() {
        return configName;
    }


    /**
     * @param configName the configName to set
     */
    public void setConfigName(String configName) {
        this.configName = configName;
    }


    /**
     * @return the shardCount
     */
    public Integer getShardCount() {
        return shardCount;
    }


    /**
     * @param shardCount the shardCount to set
     */
    public void setShardCount(Integer shardCount) {
        this.shardCount = shardCount;
    }


    /**
     * @return the replicationFactor
     */
    public Integer getReplicationFactor() {
        return replicationFactor;
    }


    /**
     * @param replicationFactor the replicationFactor to set
     */
    public void setReplicationFactor(Integer replicationFactor) {
        this.replicationFactor = replicationFactor;
    }


    /**
     * @return the maxShardsPerNode
     */
    public Integer getMaxShardsPerNode() {
        return maxShardsPerNode;
    }


    /**
     * @param maxShardsPerNode the maxShardsPerNode to set
     */
    public void setMaxShardsPerNode(Integer maxShardsPerNode) {
        this.maxShardsPerNode = maxShardsPerNode;
    }


    /**
     * @return the autoAddReplicas
     */
    public boolean isAutoAddReplicas() {
        return autoAddReplicas;
    }


    /**
     * @param autoAddReplicas the autoAddReplicas to set
     */
    public void setAutoAddReplicas(boolean autoAddReplicas) {
        this.autoAddReplicas = autoAddReplicas;
    }


    /**
     * @return the name
     */
    public String getName() {
        return name;
    }


    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }


    /**
     * @return the router
     */
    public Router getRouter() {
        return router;
    }


    /**
     * @param router the router to set
     */
    public void setRouter(Router router) {
        this.router = router;
    }

}
